< previous page page_470 next page >

Page 470
The RefinedGrid3d class is simply a container for a collection of Polyline3d objects. Each of these objects represents a series of lines drawn parallel to the X or Z axis. The RefinedGrid3d class provides several methods for managing the Polyline3d objects. These methods simply iterate through the collection of Polyline3d objects, passing requests to those objects.
e10a6a0a59f035e870d90cca05b85fce.gif
Option Explicit

' The collection of Polyline3d objects.
Public Polylines As Collection

' Create the empty Polylines collection.
Private Sub Class_Initialize() 
    Set Polylines = New Collection 
End Sub

' Apply a transformation matrix which may not
' contain 0, 0, 0, 1 in the last column to the
' object.
Public Sub ApplyFull(M() As Single)
Dim pline As Polyline3d

    For Each pline In Polylines 
        pline.ApplyFull M 
    Next pline 
End Sub 

' Apply a transformation matrix to the object.
Public Sub Apply(M() As Single)
Dim pline As Polyline3d

    For Each pline In Polylines
        pline.Apply M
    Next pline
End Sub

' Draw the transformed points on a PictureBox.
Public Sub Draw(ByVal pic As Object)
Dim pline As Polyline3d

    For Each pline In Polylines
        pline.Draw pic
    Next pline
End Sub
Example program Surface2 uses the following code to initialize its surface data. The YValue function returns the Y coordinate for a surface for given X and Z coordinates. Program Surface2 displays the same surfaces shown by program Surface1. Surface2's grid uses fewer curves that contain more data points.

 
< previous page page_470 next page >